package com.example.listener;

import com.example.event.MyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

@Component
public class CustomeventListener {
    //监听资源
    @EventListener(MyEvent.class)
    public void onApplicationEvent(MyEvent myEvent){
        System.out.println("监听器接受消息："+System.currentTimeMillis());
        System.out.println("接收到的消息为："+myEvent.getContent());
    }
}
